from django.urls import path, include
from rest_framework.routers import DefaultRouter
from .views import RepairRecordViewSet, MaintenanceItemViewSet, RepairRecordImageViewSet

# 创建路由器
router = DefaultRouter()
router.register(r'repair-records', RepairRecordViewSet, basename='repairrecord')
router.register(r'maintenance-items', MaintenanceItemViewSet, basename='maintenanceitem')
router.register(r'repair-record-images', RepairRecordImageViewSet, basename='repairrecordimage')

urlpatterns = [
    path('', include(router.urls)),
]

# API端点说明：
# GET /repair-records/ - 获取维修记录列表
# POST /repair-records/ - 创建新的维修记录
# GET /repair-records/{id}/ - 获取特定维修记录详情
# PUT /repair-records/{id}/ - 更新特定维修记录
# DELETE /repair-records/{id}/ - 删除特定维修记录
# GET /repair-records/{id}/export_excel/ - 导出维修记录为Excel
# POST /repair-records/import_word/ - 导入Word文档
#
# GET /maintenance-items/ - 获取维保记录列表
# POST /maintenance-items/ - 创建新的维保记录
# GET /maintenance-items/{id}/ - 获取特定维保记录详情
# PUT /maintenance-items/{id}/ - 更新特定维保记录
# DELETE /maintenance-items/{id}/ - 删除特定维保记录
# GET /maintenance-items/categories/ - 获取所有系统分类
# GET /maintenance-items/by_category/?category=xxx - 按分类获取维保记录
# POST /maintenance-items/batch_create/ - 批量创建维保记录
#
# GET /repair-record-images/ - 获取维修记录附图列表
# POST /repair-record-images/ - 上传单个附图
# GET /repair-record-images/{id}/ - 获取特定附图详情
# DELETE /repair-record-images/{id}/ - 删除特定附图
# GET /repair-record-images/{id}/download/ - 下载附图文件
# GET /repair-record-images/{id}/preview/ - 在线预览附图
# POST /repair-record-images/batch_upload/ - 批量上传附图